home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 7 / Eagles_Nest_Mac_Collection_Disc_7.TOAST / General Communication / VersaTrmP503 / Network Utilities.image / README Files / Special FTP Server Commands next >
Text File  |  1992-01-08  |  4KB  |  148 lines

  1. January 8, 1992
  2.  
  3. VersaTerm FTP Server "account" features.
  4.  
  5. Most FTP client programs support an "account" command, (FTP token ACCT), and can be used to activate several features in the VersaTerm FTP Server.
  6.  
  7. The commands are issued by "account <keyword>" from most UNIX and VMS, FTP client shells.
  8.  
  9. Keyword:
  10. • mac - use "MacBinary style" binary transfers.
  11.  
  12. • bin - use "Straight Binary" binary transfers.
  13.  
  14. • record - records the current date into a file "Last FTP Backup" in your System Folder.  This information can be used to record the last time you performed a backup.
  15.  
  16. Additionally, backup mode is turned off.
  17.  
  18. • backup - forces ls and dir (NLST and LIST tokens) to only display files that have modification dates newer than the date recorded in your "Last FTP Backup" file.  If no file exists, all files are displayed.
  19.  
  20. • backupNNN (NNN = 1...999) - same as backup, except the "Last FTP Backup" file is ignored and files with modification dates newer than NNN days will be displayed.
  21.  
  22. • tree - forces ls and dir (NLST and LIST tokens) to display ALL files nested in the directory structure, not just the files in the current directory.  A maximum of 19 levels of directories are searched.
  23.  
  24. • treeN (N = 1...9) - limits the tree command to N levels of directories.
  25.  
  26. • tree0 - turn off tree mode.
  27.  
  28. • dirtree - forces ls and dir (NLST and LIST tokens) to display ALL directories nested in the directory structure, not just the files in the current directory.  Only directories are listed. A maximum of 19 levels of directories are searched.
  29.  
  30. • dirtreeN (N = 1...9) - limits the dirtree command to N levels of directories.
  31.  
  32. • dirtree0 - turn off dirtree mode.
  33.  
  34. • full - enables full_filenames where '/' characters are used to denote different directories.
  35.  
  36. • full0 - turn off full_filenames, '/' characters are used as characters of the filename.
  37.  
  38.  
  39.  
  40.  
  41.  
  42. Example FTP incremental backup using the VersaTerm FTP Server and UNIX host:
  43.  
  44. Following is a very simple UNIX style ftp script, lonnie.sh is a shell script that used lonnie.ftp as input.  The command "mkbakdir" takes a list of directories and creates the same directories on the host, if necessary.
  45.  
  46. ----Start of File: lonnie.sh
  47. echo "Performing lonnie backup..."
  48. ftp -nv < lonnie.ftp 2> /dev/null
  49. echo "Backup complete."
  50. ----End of FIle: lonnie.sh
  51.  
  52. ----Start of File: lonnie.ftp
  53. open lonnie
  54. user backup password
  55. account backup
  56. binary
  57. prompt
  58. macdef dobak
  59. lcd $1
  60. cd $2
  61. account dirtree
  62. mls * tree.dir
  63. !mkbakdir tree.dir $1
  64. account tree
  65. mget *
  66.  
  67. $ dobak /dat/lra/sys/src /sys/src
  68. $ dobak /dat/lra/sys/MPW /sys/MPW
  69. $ dobak /dat/lra/sys/doc /sys/doc
  70. account recordbackup
  71. quit
  72. ----End of File: lonnie.ftp
  73.  
  74. ----Start of File: mkbakdir.c
  75. #include <stdio.h>
  76. #include <sys/types.h>
  77. #include <sys/stat.h>
  78.  
  79. /*
  80.  * Copyright 1991 Abelbeck Software
  81.  * by Lonnie R. Abelbeck
  82.  *
  83.  */
  84.  
  85. /*
  86.  * remember that mknod() needs super-user permissions!
  87.  */
  88.  
  89. main(argc, argv)
  90. int argc;
  91. char *argv[];
  92. {
  93.     FILE *text;
  94.     int mask;
  95.     char path[512];
  96.     char root[256];
  97.     char buf[256];
  98.     char *cp;
  99.     struct stat sbuf;
  100.     unsigned short owner;
  101.     unsigned short getuid();
  102.  
  103.     owner = getuid();
  104.  
  105.     if (argc != 3) {
  106.         printf("Usage: mkbakdir infile pathname\n");
  107.         exit(1);
  108.     }
  109.  
  110.     if ((text = fopen(*(argv + 1), "r")) == NULL) {
  111.         printf ("mkbakdir: cannot open %s.\n", *(argv + 1));
  112.         exit(1);
  113.     }
  114.  
  115.     strcpy(root, *(argv + 2));
  116.  
  117.     while (fgets( buf, 256, text) != NULL) {
  118.         cp = buf;
  119.         while (*cp && *cp != '\n') {
  120.             cp++;
  121.         }
  122.         if (cp == buf) {
  123.             continue;
  124.         }
  125.         *cp = '\0';
  126.  
  127.         strcpy(path, root);
  128.         strcat(path, "/");
  129.         strcat(path, buf);
  130.  
  131.         if (stat(path, &sbuf) == -1) {
  132.             mask |= 0040775;
  133.             if (mknod( path, mask, 0) == -1) {
  134.                 printf("mkbakdir: failed to create directory, %s\n", path);
  135.             } else {
  136.                 chown( path, owner, owner);
  137.                 printf("Directory \"%s\" created.\n", path);
  138.             }
  139.         } else {
  140.             if (!(sbuf.st_mode & 0040000)) {
  141.                 printf("\"%s\" is a file.\n", path);
  142.             }
  143.         }
  144.     }
  145.     fclose (text);
  146. }
  147. ----End of File: mkbakdir.c
  148.